﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link href="__STATIC__/admin/assets/css/bootstrap.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__STATIC__/admin/css/style.css"/>
	<link href="__STATIC__/admin/assets/css/codemirror.css" rel="stylesheet">
	<link rel="stylesheet" href="__STATIC__/admin/assets/css/ace.min.css" />
	<link rel="stylesheet" href="__STATIC__/admin/font/css/font-awesome.min.css" />
	<!--[if lte IE 8]>
	<link rel="stylesheet" href="__STATIC__/admin/assets/css/ace-ie.min.css" />
	<![endif]-->
	<script src="__STATIC__/admin/js/jquery-1.9.1.min.js"></script>
	<script src="__STATIC__/admin/assets/js/bootstrap.min.js"></script>
	<script src="__STATIC__/admin/assets/js/typeahead-bs2.min.js"></script>
	<script src="__STATIC__/admin/assets/js/jquery.dataTables.min.js"></script>
	<script src="__STATIC__/admin/assets/js/jquery.dataTables.bootstrap.js"></script>
	<script src="__STATIC__/admin/assets/layer/layer.js" type="text/javascript" ></script>
	<script src="__STATIC__/admin/assets/laydate/laydate.js" type="text/javascript"></script>
	<script src="__STATIC__/admin/js/curd.js"></script>
	<title>管理权限</title>
</head>
<body>
<div class="margin clearfix">
	<div class="border clearfix">
       <span class="l_f">
		<a href="javascript:;" id="tree_open" class="btn btn-danger radius tree_open"> <span>收缩权限</span></a>
<!--					<a href="javascript:;" data-url="{:url('create')}" id="add" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加权限</a>-->
        <a href="javascript:;" data-url="{:url('create')}" data-type="full" id="add"   class="btn btn-warning" title="添加权限"><i class="fa fa-plus"></i> 添加权限</a>
<!--        <a href="javascript:;" id="tree_open" class="btn btn-danger tree_open"><i class="fa fa-trash"></i>收缩权限<</a>-->
       </span>
		<span class="r_f">共：<b>{:count($list)}</b>条</span>
	</div>
	<div class="compete_list">
			<table class="table table-border table-bordered table-bg">
				<thead>
					<tr>
						<th scope="col" colspan="7">权限</th>
					</tr>
					<tr class="text-c">
						<th width="10%">[+/-]</th>
						<th width="10%">ID</th>
						<th width="20%">权限名称</th>
						<th width="10%">控制器名</th>
						<th width="10%">方法名</th>
						<th width="10%">是否菜单权限</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					{foreach $list as $v}
					<tr class="text-c level_{$v.level}">
						<td>
							{if($v.level lt 3)}
							{:str_repeat('&emsp;', $v.level*2)}
							[<a href="javascript:;">-</a>]
							{/if}
						</td>
						<td>{$v.id}</td>
						<td class="text-l">{:str_repeat('&emsp;', $v.level*2)}{$v.auth_name}</td>
						<td>{$v.auth_c}</td>
						<td>{$v.auth_a}</td>
						<td>{$v.is_nav}</td>
						<td>
							{if($v.level lt 3)}
							<a title="添加下级" data-url="{:url('create', ['pid'=>$v.id])}?pid=" href="javascript:;" class="ml-5 add_child" style="text-decoration:none"><i class="Hui-iconfont">&#xe600;</i></a>
							{/if}
							<a title="编辑" data-url="{:url('edit', ['id'=>$v.id])}" href="javascript:;" class="ml-5 edit" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
							<a title="删除" data-url="{:url('delete', ['id'=>$v.id])}" href="javascript:;" class="ml-5 delete" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
						</td>
					</tr>
					{/foreach}
				</tbody>
			</table>
	</div>
</div>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/hadmin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/static/hadmin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/hadmin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="/static/hadmin/logic/curd.js"></script>
<script type="text/javascript">
/*
	参数解释：
	title	标题layer_show()
	url		请求的url
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/
</script>
<script>

	$(function(){
		$('tr.level_0').find('td:first-child a').click(function(){
			var str = $(this).html() == '-';
			if(str){
				//收起
				$(this).html('+').closest('tr').nextUntil('.level_0').hide();
			}else{
				//展开
				$(this).html('-').closest('tr').nextUntil('.level_0').show();
			}
		});
		$('tr.level_1').find('td:first-child a').click(function(){
			var str = $(this).html() == '-';
			if(str){
				//收起
				$(this).html('+').closest('tr').nextUntil('.level_1,.level_0').hide();
			}else{
				//展开
				$(this).html('-').closest('tr').nextUntil('.level_1,.level_0').show();
			}
		});
		$('#tree_open').click(function(){
			var status = $(this).find('span').text() == '收缩权限';
			if(status){
				$(this).find('i').html('&#xfe3e;');
				$(this).find('span').text('展开权限');
				$('tr.level_0>td:first-child a').html('+');
				$('tbody tr').not('.level_0').hide();
			}else{
				$(this).find('i').html('&#xfe3d;');
				$(this).find('span').text('收缩权限');
				$('.level_0>td:first-child a').html('-');
				$('tbody tr').not('.level_0').show();
			}
		});
	});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>